﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace lcs.Web.Controls
{
    public partial class workPlan : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request["workplan_id"]))
                {
                    Maticsoft.BLL.workplan wm = new Maticsoft.BLL.workplan();
                    lcs.BLL.user um = new BLL.user();

                    int workplan_id = int.Parse(Request["workplan_id"]);
                    
                    Maticsoft.Model.workplan w = wm.GetModel(workplan_id);

                    lcs.Model.user u = um.GetModel(w.submit_uid.Value);

                    string user_name = u.user_name;

                   


                    //this.lbl_content.Text = w.workplan_content;
                    this.lbl_info.Text = "提交人：" + user_name + "，提交时间：" + w.submit_time+",类型："+w.workplan_type;
                    this.lbl_title.Text = w.workplan_title;

                    DataSet ds = new Maticsoft.BLL.workplan_detail().GetList(" workplan_id= " + workplan_id + " order by orderId  ");
                    this.GridView1.DataSource = ds;
                    this.GridView1.DataBind();

                    if (u.roles_id == 1023)
                    {
                        //基层员工
                        this.GridView1.Columns[3].Visible = false;
                        this.GridView1.Columns[4].Visible = false;
                    }

                }
            }
        }

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lbl_iscomp = (Label)e.Row.FindControl("lbl_iscomp");

                if (lbl_iscomp.Text == "False")
                {
                    lbl_iscomp.Text = "否";
                }
                else
                {
                    lbl_iscomp.Text = "是";
                }
            }
        }
    }
}